<script lang="ts" setup name="testAi">
import { api } from '@/index';

const chatRes = ref('默认内容');

const getChatRes = async () => {
  const res = await api({
    method: 'get',
    url: '/ai/chat'
  });
  if (res.status === 200) {
    chatRes.value = res.data;
  } else {
    ElMessage.error(res.statusText);
  }
};
</script>
<template>
  <el-divider content-position="left">chat</el-divider>
  <el-button @click="getChatRes">getChatRes</el-button>
  <div class="chat-res">{{ chatRes }}</div>
</template>
<style lang="scss" scoped>
.chat-res {
  width: 100%;
  height: 1000px;
  padding: 10px;
  line-height: 30px;
  background-color: #eee;
}
</style>
